package com.example.zuoye1;

import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;

public class CakeDB {
    private static final Map<String, Cake> cakes = new LinkedHashMap<>();

    static {
        // 初始化一些蛋糕数据
        cakes.put("1", new Cake("1", "A类蛋糕", 99.99));
        cakes.put("2", new Cake("2", "B类蛋糕", 66.66));
        cakes.put("3", new Cake("3", "C类蛋糕", 44.44));
        cakes.put("4", new Cake("4", "D类蛋糕", 22.22));
        // 更多蛋糕...
    }

    public static Collection<Cake> getAll() {
        return cakes.values();
    }

    public static Cake getCake(String id) {
        return cakes.get(id);
    }
}

